﻿@using MC.RideEvent.Mvc.Helpers
@using MC.RideEvent.Mvc.Models.ViewModel
@model WayViewModel

@{
    ViewBag.Title = "Formulaire devenir passager";
    var member = Session["CurrentMember"] as MemberViewModel;
}
<div class="summery-way">
    <h3>Récapitulatif du trajet</h3>
    <div class="item-way">
        <div class="field">
            <label>Evenement</label>
            <span>@Model.Event.Title - @Model.Event.DateBegin.ToStringFr() (@Model.Event.City)</span>
        </div>
        <div class="field">
            <label>Vehicule</label>
            <span>@Model.Vehicule.BrandAndModelToString</span>
        </div>
        <div class="field">
            <label>Rendez-vous</label>
            <span>@Model.MeetingPlace - @Model.MeetingHour</span>
        </div>
        <div class="field">
            <label>Participation</label>
            <span>@Model.Contribution</span>
        </div>
        <div class="field">
            <label>Places disponibles</label>
            <span>@Model.NumberPlaces</span>
        </div>
    </div>
</div>

<h3>Formulaire devenir passager </h3>
@{
    Ajax.BeginForm("BecomePassager", "Way", new AjaxOptions { HttpMethod = "post", OnComplete = "onComplete" });
    @Html.Hidden("WayId")
    <input id="btnenregistrer" type="button" value="Enregistrer"/>
}

<script type="text/javascript">
    $(document).ready(function () {
        $("").on("", BecomePassagerSb);
    });

    function BecomePassagerSb() {
        $.ajax({
            url: "VehiculeBrand/Brands",
            async: false,
            type: "post",
            data: { wayId : '@Model.Id'},
            //dataType: "json",
            success: function (data) {
                console.log(data);
            }
        });
    }

    function onComplete(data) {
        console.log(data);
    }
</script>